﻿class MathUtils {
    static pi: number = 3.14159;

    static add(x: number, y: number): number {
        return x + y;
    }

    static subtract(x: number, y: number): number {
        return x - y;
    }

    static multiply(x: number, y: number): number {
        return x * y;
    }

    static divide(x: number, y: number): number {
        if (y === 0) {
            throw new Error("Cannot divide by zero.");
        }
        return x / y;
    }
}

console.log(MathUtils.add(10, 5)); // 输出: 15
console.log(MathUtils.subtract(10, 5)); // 输出: 5
console.log(MathUtils.multiply(10, 5)); // 输出: 50
console.log(MathUtils.divide(10, 5)); // 输出: 2
console.log(MathUtils.pi); // 输出: 3.14159
